<?php
    include "../mysql/mysql.php";
    $aa = new mysql;
    $aa->link("");
    include "../myfunction.php";
    $bb= new myfunction;



$q=@$_GET["q"]; 
$qq= explode("-", $q); 
switch($qq[0]){
	case 'tjnewclass': tjnewclass($qq); break;
	case 'updateclass': updateclass($qq); break;
	case 'delclass': delclass($qq); break;
	case 'delpro': delpro($qq); break;
	default: echo "程序君出了点小状况，请稍后再试"; break;
	}

function tjnewclass($qq){
	global $aa; global $bb;
	$sql = "INSERT INTO product_class (class_name, show_order)
                      VALUES ('$qq[1]', '$qq[2]')";
    $result= $aa->excu($sql);


if($result == 'TURE'){
	echo '类别已添加';
	}else{
		echo "添加新类别失败,请重试！";
		}

	}


function updateclass($qq){
	global $aa; global $bb;
	$sql = "UPDATE product_class SET class_name= '".$qq[1]."' and show_order= '".$qq[2]."' WHERE id='".$qq[3]."' ";

    $result= $aa->excu($sql);


if($result == 'TURE'){
	echo '类别信息已更新';
	}else{
		echo "更新类别信息失败,请重试！";
		}

	}

function delclass($qq){
	global $aa; global $bb;
	$sql = "DELETE FROM product_class WHERE id='".$qq[1]."' ";
    $result= $aa->excu($sql);


if($result == 'TURE'){
	echo '类别已删除';
	}else{
		echo "类别删除失败,请重试！";
		}

	}

function delpro($qq){

	global $aa; global $bb;
	$sql = "DELETE FROM product_info WHERE id='".$qq[1]."'";
    $result= $aa->excu($sql);


if($result == 'TURE'){
	echo '商品已删除';
	}else{
		echo "商品删除失败,请重试！";
		}

	}


include "../mysql/mysqlclose.php";
?>